package ai;

import java.util.List;

import ai.evaluation.Evaluator;

import structure.Board;
import structure.Move;

public class RandomAI extends AI {
	
	
	public RandomAI(){}
	
	protected RandomAI(Evaluator evaluator, byte color, Board board) {
		super(evaluator,color,board);
	}

	@Override
	public Move getMove(Board board, byte color) {
		List<Move> moves = board.getValidMoves(color);
		return moves.get((int)((moves.size()-1)*Math.random()));
	}

	@Override
	public String getName() {
		return "RANDOM";
	}

	@Override
	protected AI createAI(Evaluator evaluator, byte color, Board board) {
		return new RandomAI(evaluator,color,board);
	}

	@Override
	public void play(Move move) {
		setBoard(getBoard().doMove(move));
	}

}